﻿<?xml version="1.0" encoding="utf-8" ?>
<Workflows>
	<Workflow Name="CruxSampleWorkflow" StartActivity="RequestCreation" EndActivity="End">
		<Activities>
			<Activity Name="RequestCreation" NextActivity="DriverInput" 
					  State="RequestCreation" PreviousActivity="None">
				<Actions>
					<Action Name="SavePickupRequest" ResultantActivity="RequestCreation" />
					<Action Name="SubmitPickupRequest" ResultantActivity="DriverInput" />
					<Action Name="SubmitDeliveryRequest" ResultantActivity="ReceivingDepartmentValidation" />
				</Actions>
			</Activity>

			<Activity Name="DriverInput" NextActivity="ReceivingDepartmentValidation"
				State="DriverInput" PreviousActivity="StartWorkflow">
				<Actions>
					<Action Name="SaveDriverPickupRequest" ResultantActivity="DriverInput" />
					<Action Name="SubmitDriverPickupRequest" ResultantActivity="ReceivingDepartmentValidation" />
				</Actions>
			</Activity>

			<Activity Name="ReceivingDepartmentValidation" NextActivity="ProductionDepartmentLotCreation"
				State="ReceivingDepartmentValidation" PreviousActivity="DriverInput">
				<Actions>
					<Action Name="SaveReceivingDepartmentPickupRequest" ResultantActivity="ReceivingDepartmentValidation" />
					<Action Name="SubmitReceivingDepartmentPickupRequest" ResultantActivity="ProductionDepartmentLotManagement" />
				</Actions>
			</Activity>

			<Activity Name="ProductionDepartmentLotManagement" NextActivity="RecipeCreation"
				State="ProductionDepartmentLotManagement" PreviousActivity="DriverInput">
				<Actions>
					<Action Name="SubmitProductionDepartmentLotCreation" ResultantActivity="RecipeCreation" />
                    <Action Name="CompletedLotCreation" ResultantActivity="ProductionSort" />
				</Actions>
			</Activity>

			<!-- Lot Based Activities For A Sub Workflow Fork And Join. -->
			<Activity Name="IndividualLotManagement"
				State="IndividualLotManagement">
				<Actions>
					<Action Name="SubmitIndividualLot" ResultantActivity="RecipeCreation" />
                    <Action Name="JumpToProductionSort" ResultantActivity="ProductionSort" />
                </Actions>
			</Activity>

			<Activity Name="RecipeCreation"
				State="RecipeCreation">
				<Actions>
					<Action Name="CompleteProcessSelection" ResultantActivity="ProductionSort" />
				</Actions>
			</Activity>

			<Activity Name="ProductionSort" State="ProductionSort">
				<Actions>
					<Action Name="ProductionSortComplete" ResultantActivity="End" />
				</Actions>
			</Activity>
			

			<Activity Name="End" NextActivity="None"
					  State="WorkflowEnded" PreviousActivity="ReceivingDepartmentValidation"/>
		</Activities>

	</Workflow>
</Workflows>